<?php
namespace app\index\controller;
use app\model\Medium as MediumModel;

use think\Db;


class Medium extends Base
{   
    protected $noCheckToken = ['index','read'];
    
    // 列表
    public function index(){
        $map_params = [
           ['key'=>'type','type'=>'=']
        ];
        $map = getSearchParam($map_params);
        if (isSearchParam('keyword_search')) {
            $map[] = ['name','like','%'.input('keyword_search').'%'];
        }
        $model = new MediumModel();
        $page_param = ['page'=>input('page_index',1),'list_rows'=>input('page_size',10)];
        $list = $model->where($map)->order('sort desc,create_time desc')->paginate($page_param)->toarray();
        foreach ($list['data'] as $k => $vo) {
            
        }

        return apiResult('2000','获取成功',$list);
    }

    // 详情
    public function read($uuid){
        $model = new MediumModel();
        $data = $model->where('uuid',$uuid)->find();
        return apiResult('2000','获取成功',$data);
    }

   


}
